#include "RPGBox.hpp"

 void RPGBox::Load_Background(string filename)
 {
    Image.LoadFromFile(filename);
    Sprite.SetImage(Image);
 }

 void RPGBox::Load_Font(string filename)
 {
     Font.LoadFromFile(filename);
 }

void RPGBox::Set_Text(string Message, int size)
{
    Original_Text = Message;

    Text.SetText(Message.c_str() );

    Text.SetFont(Font);
    Text.SetSize(size);
}

void RPGBox::Set_Offset(int x, int y)
{
    //this sets the offset of the text
    Text.SetX(Position.x + x);
    Text.SetY(Position.y + y);

}

void RPGBox::Set_Position(int x, int y)
{
    Position.x = x;
    Position.y = y;

    Sprite.SetPosition(Position);
}

void RPGBox::Scroll_Text()
{
    /*
    -scroll text
    */

    static sf::Clock Clock;
    string temp; //used to increment the text
    static int Current_Var = 0; // used var to track what char we're on.

    if(Clock.GetElapsedTime() < Delay)
    {
        //it's not time to update yet

    }
    else
    {
        Current_Var += 3;
        //it's time to add new characters
        Text.SetText( Original_Text.substr(0, Current_Var) );

        Clock.Reset(); // rest clock
    }

}

 RPGBox::RPGBox()
 {
    //used for setting defaults
    Load_Background("Data/RPGBox.png");
    Load_Font("Data/Font.ttf");
    Set_Text("Hello World", 12);
    Set_Offset(2,2);
 }
